package com.wyzy.book.dao;

import com.wyzy.book.model.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

@Repository
public class BookDao {
    public List<Book> mockData(){
        List<Book> books = new ArrayList<>();
        for(int i = 1;i <= 8;i++){
            Book book = new Book();
            book.setId(i);
            book.setBookName("图书" + i);
            book.setAuthor("作者" + i);
            book.setCount(new Random().nextInt(100));
            book.setPrice(new BigDecimal(new Random().nextInt(100)));
            book.setPublish("出版社" + i);
            book.setStatus(i % 5 == 0?2:1);
            books.add(book);
        }
        return books;
    }
}
